Skip to contentSkip to conversation

Change in openvpn[master]: multi-socket: remove duplicated/dead code

Openvpn-devel In review its_Giaan (Code Review) 2 participants 6 messages Nov 20, 2025 – Nov 22, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1763636270000.Id1457f8432b4f0a69108b91ca12f2cbd0818f90d@...2715...

#1 lore raw

Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1384?usp=email

to review the following change.

Change subject: multi-socket: remove duplicated/dead code
......................................................................

multi-socket: remove duplicated/dead code

Removed the event_ctl() for ENABLE_ASYNC_PUSH
in io_wait_dowork() since that function is
not executed by servers anymore.

Removed a duplicated code in multi_io_process_io() for new incoming TCP connections since the same thing is done couple lines above.

Change-Id Id1457f8432b4f0a69108b91ca12f2cbd0818f90d

---
M src/openvpn/forward.c
M src/openvpn/multi_io.c

2 files changed, 2 insertions(+), 23 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/84/1384/1

src/openvpn/forward.c +1 -11
index d57cbe0..ccb8404 100644
@@ -2214,9 +2214,7 @@
     static uintptr_t management_shift =
         MANAGEMENT_SHIFT; /* depends on MANAGEMENT_READ and MANAGEMENT_WRITE */
 #endif
-#ifdef ENABLE_ASYNC_PUSH
-    static uintptr_t file_shift = FILE_SHIFT;
-#endif
+
 #if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
     static uintptr_t dco_shift = DCO_SHIFT; /* Event from DCO linux kernel module */
 #endif
@@ -2242,14 +2240,6 @@
     }
 #endif
 
-#ifdef ENABLE_ASYNC_PUSH
-    /* arm inotify watcher */
-    if (c->options.mode == MODE_SERVER)
-    {
-        event_ctl(c->c2.event_set, c->c2.inotify_fd, EVENT_READ, (void *)file_shift);
-    }
-#endif
-
     /*
      * Possible scenarios:
      *  (1) tcp/udp port has data available to read
src/openvpn/multi_io.c +1 -12
index 6e31687..fe72456 100644
@@ -500,18 +500,7 @@
                         multi_io_action(m, NULL, TA_TUN_READ, false);
                     }
                 }
-                /* new incoming TCP client attempting to connect? */
-                else if (e->arg == MULTI_IO_SOCKET)
-                {
-                    struct multi_instance *mi;
-                    ASSERT(m->top.c2.link_sockets[0]);
-                    socket_reset_listen_persistent(m->top.c2.link_sockets[0]);
-                    mi = multi_create_instance_tcp(m, m->top.c2.link_sockets[0]);
-                    if (mi)
-                    {
-                        multi_io_action(m, mi, TA_INITIAL, false);
-                    }
-                }
+
 #if defined(ENABLE_DCO)
                 /* incoming data on DCO? */
                 else if (e->arg == MULTI_IO_DCO)

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1384?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id1457f8432b4f0a69108b91ca12f2cbd0818f90d
Gerrit-Change-Number: 1384
Gerrit-PatchSet: 1
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: its_Giaan, plaisthos.

cron2 has posted comments on this change by its_Giaan. ( http://gerrit.openvpn.net/c/openvpn/+/1384?usp=email )

Change subject: multi-socket: remove duplicated/dead code
......................................................................

Patch Set 1: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1384?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id1457f8432b4f0a69108b91ca12f2cbd0818f90d
Gerrit-Change-Number: 1384
Gerrit-PatchSet: 1
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: its_Giaan <[email protected]...>
Gerrit-Comment-Date: Sat, 22 Nov 2025 18:52:24 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes

#3 lore raw

PATCH 1/1 multi-socket: remove duplicated/dead code

In reply to a message not in the archive

From: Gianmarco De Gregori <[email protected]...>

Removed the event_ctl() for ENABLE_ASYNC_PUSH
in io_wait_dowork() since that function is
not executed by servers anymore.

Removed a duplicated code in multi_io_process_io() for new incoming TCP connections since the same thing is done couple lines above.

Change-Id Id1457f8432b4f0a69108b91ca12f2cbd0818f90d

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1384
---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1384
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>

src/openvpn/forward.c +1 -11
index d57cbe0..ccb8404 100644
@@ -2214,9 +2214,7 @@
     static uintptr_t management_shift =
         MANAGEMENT_SHIFT; /* depends on MANAGEMENT_READ and MANAGEMENT_WRITE */
 #endif
-#ifdef ENABLE_ASYNC_PUSH
-    static uintptr_t file_shift = FILE_SHIFT;
-#endif
+
 #if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
     static uintptr_t dco_shift = DCO_SHIFT; /* Event from DCO linux kernel module */
 #endif
@@ -2242,14 +2240,6 @@
     }
 #endif
 
-#ifdef ENABLE_ASYNC_PUSH
-    /* arm inotify watcher */
-    if (c->options.mode == MODE_SERVER)
-    {
-        event_ctl(c->c2.event_set, c->c2.inotify_fd, EVENT_READ, (void *)file_shift);
-    }
-#endif
-
     /*
      * Possible scenarios:
      *  (1) tcp/udp port has data available to read
src/openvpn/multi_io.c +1 -12
index 6e31687..fe72456 100644
@@ -500,18 +500,7 @@
                         multi_io_action(m, NULL, TA_TUN_READ, false);
                     }
                 }
-                /* new incoming TCP client attempting to connect? */
-                else if (e->arg == MULTI_IO_SOCKET)
-                {
-                    struct multi_instance *mi;
-                    ASSERT(m->top.c2.link_sockets[0]);
-                    socket_reset_listen_persistent(m->top.c2.link_sockets[0]);
-                    mi = multi_create_instance_tcp(m, m->top.c2.link_sockets[0]);
-                    if (mi)
-                    {
-                        multi_io_action(m, mi, TA_INITIAL, false);
-                    }
-                }
+
 #if defined(ENABLE_DCO)
                 /* incoming data on DCO? */
                 else if (e->arg == MULTI_IO_DCO)
#4 lore raw

[Openvpn-devel] [PATCH applied] Re: multi-socket: remove duplicated/dead code

Thanks for working on the cleanup - I can see where this came from (the multisocket patch, and the remodelling of the event info that came with it). Especially the ASYNC_PUSH stuff got duplicated (FILE_CLOSED in the other patch) and I can see the other handler for incoming TCP sockets.

I have run this through the server side testbeds on Linux with and without DCO, and everything still works (and this does excercise the TCP listening code and also the async file stuff).

Your patch has been applied to the master branch.

commit 779ab39d88c8ac83c67b69741d80b79a4587ad25

Author: Gianmarco De Gregori
Date:   Sat Nov 22 19:52:33 2025 +0100
     multi-socket: remove duplicated/dead code

     Signed-off-by: Gianmarco De Gregori <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1384
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg34593.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#5 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#2) to the change originally created by its_Giaan. ( http://gerrit.openvpn.net/c/openvpn/+/1384?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by cron2

Change subject: multi-socket: remove duplicated/dead code
......................................................................

multi-socket: remove duplicated/dead code

Removed the event_ctl() for ENABLE_ASYNC_PUSH
in io_wait_dowork() since that function is
not executed by servers anymore.

Removed a duplicated code in multi_io_process_io() for new incoming TCP connections since the same thing is done couple lines above.

Change-Id Id1457f8432b4f0a69108b91ca12f2cbd0818f90d

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1384
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34593.html

---
M src/openvpn/forward.c
M src/openvpn/multi_io.c

2 files changed, 2 insertions(+), 23 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/84/1384/2

src/openvpn/forward.c +1 -11
index f01fb4c..a6d3394 100644
@@ -2214,9 +2214,7 @@
     static uintptr_t management_shift =
         MANAGEMENT_SHIFT; /* depends on MANAGEMENT_READ and MANAGEMENT_WRITE */
 #endif
-#ifdef ENABLE_ASYNC_PUSH
-    static uintptr_t file_shift = FILE_SHIFT;
-#endif
+
 #if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
     static uintptr_t dco_shift = DCO_SHIFT; /* Event from DCO linux kernel module */
 #endif
@@ -2242,14 +2240,6 @@
     }
 #endif
 
-#ifdef ENABLE_ASYNC_PUSH
-    /* arm inotify watcher */
-    if (c->options.mode == MODE_SERVER)
-    {
-        event_ctl(c->c2.event_set, c->c2.inotify_fd, EVENT_READ, (void *)file_shift);
-    }
-#endif
-
     /*
      * Possible scenarios:
      *  (1) tcp/udp port has data available to read
src/openvpn/multi_io.c +1 -12
index 6e31687..fe72456 100644
@@ -500,18 +500,7 @@
                         multi_io_action(m, NULL, TA_TUN_READ, false);
                     }
                 }
-                /* new incoming TCP client attempting to connect? */
-                else if (e->arg == MULTI_IO_SOCKET)
-                {
-                    struct multi_instance *mi;
-                    ASSERT(m->top.c2.link_sockets[0]);
-                    socket_reset_listen_persistent(m->top.c2.link_sockets[0]);
-                    mi = multi_create_instance_tcp(m, m->top.c2.link_sockets[0]);
-                    if (mi)
-                    {
-                        multi_io_action(m, mi, TA_INITIAL, false);
-                    }
-                }
+
 #if defined(ENABLE_DCO)
                 /* incoming data on DCO? */
                 else if (e->arg == MULTI_IO_DCO)

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1384?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id1457f8432b4f0a69108b91ca12f2cbd0818f90d
Gerrit-Change-Number: 1384
Gerrit-PatchSet: 2
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>

#6 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1384?usp=email )

Change subject: multi-socket: remove duplicated/dead code
......................................................................

multi-socket: remove duplicated/dead code

Removed the event_ctl() for ENABLE_ASYNC_PUSH
in io_wait_dowork() since that function is
not executed by servers anymore.

Removed a duplicated code in multi_io_process_io() for new incoming TCP connections since the same thing is done couple lines above.

Change-Id Id1457f8432b4f0a69108b91ca12f2cbd0818f90d

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1384
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34593.html

---
M src/openvpn/forward.c
M src/openvpn/multi_io.c

2 files changed, 2 insertions(+), 23 deletions(-)
src/openvpn/forward.c +1 -11
index f01fb4c..a6d3394 100644
@@ -2214,9 +2214,7 @@
     static uintptr_t management_shift =
         MANAGEMENT_SHIFT; /* depends on MANAGEMENT_READ and MANAGEMENT_WRITE */
 #endif
-#ifdef ENABLE_ASYNC_PUSH
-    static uintptr_t file_shift = FILE_SHIFT;
-#endif
+
 #if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
     static uintptr_t dco_shift = DCO_SHIFT; /* Event from DCO linux kernel module */
 #endif
@@ -2242,14 +2240,6 @@
     }
 #endif
 
-#ifdef ENABLE_ASYNC_PUSH
-    /* arm inotify watcher */
-    if (c->options.mode == MODE_SERVER)
-    {
-        event_ctl(c->c2.event_set, c->c2.inotify_fd, EVENT_READ, (void *)file_shift);
-    }
-#endif
-
     /*
      * Possible scenarios:
      *  (1) tcp/udp port has data available to read
src/openvpn/multi_io.c +1 -12
index 6e31687..fe72456 100644
@@ -500,18 +500,7 @@
                         multi_io_action(m, NULL, TA_TUN_READ, false);
                     }
                 }
-                /* new incoming TCP client attempting to connect? */
-                else if (e->arg == MULTI_IO_SOCKET)
-                {
-                    struct multi_instance *mi;
-                    ASSERT(m->top.c2.link_sockets[0]);
-                    socket_reset_listen_persistent(m->top.c2.link_sockets[0]);
-                    mi = multi_create_instance_tcp(m, m->top.c2.link_sockets[0]);
-                    if (mi)
-                    {
-                        multi_io_action(m, mi, TA_INITIAL, false);
-                    }
-                }
+
 #if defined(ENABLE_DCO)
                 /* incoming data on DCO? */
                 else if (e->arg == MULTI_IO_DCO)

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1384?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id1457f8432b4f0a69108b91ca12f2cbd0818f90d
Gerrit-Change-Number: 1384
Gerrit-PatchSet: 2
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>